Skip to content

Conversation

@vogella
Copy link
Contributor

@vogella vogella commented Oct 24, 2025

Summary

Fixes #868

This PR fixes a race condition in DecoratorAdaptableTests that was causing intermittent test failures with the error:

"Adaptable test 1 has failed for object org.eclipse.ui.tests.menus.ObjectContributionClasses$A@..."

Problem

The tests were experiencing intermittent failures due to a race condition. After enabling decorators in the @Before method using setEnabled(), the decorator manager schedules asynchronous updates that may not have completed before the test assertions ran.

Solution

This PR applies the same pattern used to fix other race conditions in Eclipse UI tests (like the recent fix for MMenuItemTest in a988d08):

  1. Added import for UITestUtil which provides event loop processing utilities
  2. Added UITestUtil.processEvents() after decorator enablement in @Before to ensure all pending UI events are processed
  3. Added UITestUtil.processEvents() in @After to ensure a clean state for subsequent tests

The processEvents() method processes all pending events in the Display event queue, ensuring that decorator registration and enablement updates have completed before the test proceeds.

Test Plan

  • Successfully ran all 3 tests in DecoratorAdaptableTests:
    • testAdaptables
    • testNonAdaptableContributions
    • testContributorResourceAdapter
  • Ran tests multiple times to verify consistency
  • All tests passed with no failures or errors

Related Changes

This fix follows the same pattern as other recent race condition fixes in the repository.

🤖 Generated with Claude Code

@github-actions
Copy link
Contributor

github-actions bot commented Oct 24, 2025

Test Results

 3 018 files  ±0   3 018 suites  ±0   2h 35m 6s ⏱️ + 12m 12s
 8 234 tests ±0   7 985 ✅ ±0  249 💤 ±0  0 ❌ ±0 
23 622 runs  ±0  22 828 ✅ ±0  794 💤 ±0  0 ❌ ±0 

Results for commit 30ebb6e. ± Comparison against base commit 4ec4ff6.

♻️ This comment has been updated with latest results.

…ocessing

Fixes eclipse-platform#868

The tests testAdaptables, testNonAdaptableContributions, and
testContributorResourceAdapter were experiencing intermittent failures
due to a race condition. After enabling decorators in the @before method,
the decorator manager schedules asynchronous updates that may not have
completed before the test assertions ran.

This commit adds calls to UITestUtil.processEvents() in both @before
and @after methods to ensure all pending UI events are processed before
tests run and after tests complete. This is a standard pattern for
preventing race conditions in Eclipse UI tests.

The processEvents() method processes all pending events in the Display
event queue, ensuring that decorator registration and enablement updates
have completed before the test proceeds.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@vogella vogella force-pushed the fix-decorator-adaptable-test-race-condition branch from a6c3eb8 to 30ebb6e Compare November 3, 2025 15:01
@vogella
Copy link
Contributor Author

vogella commented Nov 3, 2025

@HeikoKlare any concerns?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

org.eclipse.ui.tests.decorators.DecoratorAdaptableTest.testAdaptables is failing on linux

1 participant